<body onload="test()">
<p>Test how sandbox flags get inherited to initial document in subframe.</p>
<div id="result">Running...</div>
<iframe src="resources/iframe-no-src.html" sandbox="allow-scripts allow-same-origin"></iframe>
<script>
if (window.testRunner) {
    testRunner.waitUntilDone();
    testRunner.dumpAsText();
}

var timeoutId;

function scriptWorked()
{
    document.getElementById("result").innerHTML = "PASS";
    if (window.testRunner)
        testRunner.notifyDone();
    clearTimeout(timeoutId);
}

function timedOut()
{
    document.getElementById("result").innerHTML = "FAIL";
    if (window.testRunner)
        testRunner.notifyDone();
}

function test()
{
    var doc = frames[0].frames[0].document;
    var scr = doc.createElement("script");
    scr.appendChild(doc.createTextNode("top.scriptWorked()"));

    timeoutId = setTimeout(timedOut, 10);

    doc.body.appendChild(scr);
}
</script>
</body>
